
<div id="blanket" style="display:none;"></div>
<div id="popUpDiv" style="display:none;">
	<a href="#" onclick="popup('popUpDiv')">Click Me To Close</a>
</div>
<script language="JavaScript">
	  var j = jQuery.noConflict();
	/*********************SPECIAL FUNCTIONS TO SHOW INFORMATION*************/
	function GetData(module,f)
	{
	
		new Ajax.Request('Model.php', {
			method: 'post',
			parameters: module,
			onSuccess: function(transport){
				f(transport.responseText);
			},
			onFailure: function(){
				$("warning").update("Could not connect to server");
			}
		})
		

	} 
	var model;
	function SimpleCallObject(module, ComponentID){
		new Ajax.Updater(ComponentID, 'Components.php', {
			method: 'post',
			parameters: module,
			evalScripts: true,
			onSuccess: function(transport){
			
			},
			onFailure: function(){
			}
		});
	}
	function CallObject(module,ComponentID)
	{
		new Ajax.Updater(ComponentID, 'Components.php', {
			method: 'post',
			parameters: module,
			evalScripts: true,
			onSuccess: function(transport){
				
			},
			onFailure: function(){
			}
		});
		CallMenu(module,'Lateral');
		model=module;
		i=1;
			while($("mm"+i)!=null)
			{
				$("mm"+i).className="";
				i++;
			}
		GetData({"module":"Core.GetActive","me":model["module"]}, f=function(response)
		{
			var accounts=JSON.parse(response);
			$(accounts["module"]).className="selected";
			
		}
	);
		
	} 
	
	function ChangeLateral(id)
	{
		model['id']=id;
		new Ajax.Updater('Workarea', 'LeftMenuChange.php', {
			method: 'post',
			parameters: model,
			evalScripts: true,
			onSuccess: function(transport)
			{
				i=0;
				
				while (document.getElementById("menu_" + i) != null) {
					document.getElementById("menu_" + i).className = "";
					i++;
				}
				document.getElementById("menu_"+id).className="selected";
			},
			onFailure: function(){
			}
		});
		
	}
	function CallMenu(module,ComponentID)
	{
		new Ajax.Updater(ComponentID, 'LeftMenu.php', {
			method: 'post',
			parameters: module,
			evalScripts: true,
			onSuccess: function(transport){
				
			},
			onFailure: function(){
			}
		});

	} 
	function MakePopup(module)
	{
		new Ajax.Updater('popUpDiv', 'Components.php', {
			method: 'post',
			parameters: module,
			evalScripts: true,
			onSuccess: function(transport)
			{
			},
			onFailure: function(){
			
			}
		})
		popup("popUpDiv");
		
	}
	
	/*********************************WEB COMPONENTS**********************************/

	

	GetData({"module":"Messages.GetMessages"}, f=function(response)
		{
			var accounts=JSON.parse(response);
			for(var i=0;i<accounts["accounts"].length;i++)
			{
				var opt = document.createElement('option');
              	opt.text = accounts["accounts"][i]["text"];
              	opt.value = accounts["accounts"][i]["value"];
                $("accounts").options.add(opt);	
			}
			
		}
	);
	GetData({"module":"IM.GetMessages"}, f=function(response)
		{
			var messages=JSON.parse(response);
			$("Chat").innerHTML=""+messages["messages"].length;
			
			
		}
	);
	 
 tinyMCE.init({
	 mode : "textareas",
	 theme : "simple",
	 debug : true

 }); 
	Logout=function()
	{
		GetData({"module":"Core.Logout"}, f=function(response){location="index.php"});
	}
	
CallObject({'module': 'Projects.ListProjects'},'Workarea');

</script>


<div id="header">
<div id="divAccounts">
<div id="ProjectName"><a style="cursor:pointer;" onclick="CallObject({'module': 'Projects.ListProjects'},'Workarea')">Selected Project: 
<span id="selectedProject"><!=projectName=!></span></a></div>
<div id="userID"><!=email=!> | <a style="cursor:pointer;" onclick="Logout()">Logout</a></div></div>
	<div id="menu">
		<table>
			<tr>
					<!=menu=!>			
			</tr>
		</table>
	</div>
	
</div>
<div id="content">
	<div id="Lateral"></div>
	<div id="Workarea" ></div>
</div>
<div id="footer">
	<div id="IconEvents"><table><tr><td class="iconstable"><span id="Messages" title="Last Messages">&nbsp;</span></td><td class="iconstable"><span id="Chat" title="Last Conversation">&nbsp;</span></td></tr></table></div>
</div>